﻿using KamRemakeNET.GameObjects.Players;
using KamRemakeRemake.GameObjects;
using KamRemakeRemake.GameObjects.MapObjects;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace KamRemakeRemake.GameStates {
    public class PlayingState : GameState {
        private HumanPlayer player;
        private Map testmap;

        public PlayingState(KaMRemake game) : base (game) {
            testmap = MapParser.LoadMap("testmap");
            this.player = new HumanPlayer(testmap);
            Camera.Instance = new Camera(testmap, game.Viewport.Width, game.Viewport.Height);
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch, ContentManager contentManager) {
            testmap.Draw(gameTime, spriteBatch, contentManager);
            this.player.Draw(gameTime, spriteBatch, contentManager);
        }

        public override void LoadContent(ContentManager contentManager) {
            this.player.LoadContent(contentManager);
            testmap.LoadContent(contentManager);
        }

        public override void Update(GameTime gameTime) {
            Camera.Instance.Update(gameTime);

            this.player.Update(gameTime);
            testmap.Update(gameTime);
        }
    }
}
